package com.xhtt.modules.cfg.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.xhtt.common.validator.group.AddGroup;
import com.xhtt.common.validator.group.UpdateGroup;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 * 常用产品
 * </p>
 *
 * @author feipc
 * @since 2019-02-19
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class CfgComprod extends Model<CfgComprod> {

    private static final long serialVersionUID = 1L;

    public static final String ID = "id";

    @TableId(value = "id", type = IdType.AUTO)
    @NotNull(message = "id不能为空", groups = {UpdateGroup.class})
    private Integer id;

    @NotNull(message = "名称不能为空", groups = {AddGroup.class, UpdateGroup.class})
    private String name;
    @NotNull(message = "类型不能为空", groups = {AddGroup.class, UpdateGroup.class})
    private String type;

    private Integer status;

    private String memo;

    private LocalDateTime createTime;

    @TableField(update = "now()")
    private LocalDateTime updateTime;

    private Integer createUserId;

    private Integer updateUserId;


    @Override
    protected Serializable pkVal() {
        return this.id;
    }

}
